package com.houtai.controller.course.comments;


import com.houtai.authority.Authority;
import com.houtai.authority.AuthorityType;
import com.houtai.bean.dto.course.PageCoureId;
import com.houtai.bean.dto.school.PageSchoolId;
import com.houtai.service.course.comments.CourseCommentsService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

/**
 * Created by lizhun on 2017/7/19.
 */
@Controller
@RequestMapping(value = {"v5"})
public class CourseCommentsController {
    @Resource
    private CourseCommentsService courseCommentsService;

    /**
     * @param request
     * @return RetInfo
     * @Purpose 分页加载在线课程评论列表
     * @version 1.0
     * @author lizhun
     */
    @RequestMapping(value = "/course/comments/list")
    @Authority(AuthorityType.Login)
    public ModelAndView comments(HttpServletRequest request, PageCoureId page) {
        ModelAndView mv = new ModelAndView("course/comments/list");
        mv.addObject("retInfo", courseCommentsService.findTdCourseCommentsList(page, request));
        mv.addObject("token", request.getParameter("token"));
        return mv;
    }

    /**
     * @param request
     * @return RetInfo
     * @Purpose 分页加载在线课程评论列表
     * @version 1.0
     * @author lizhun
     */
    @RequestMapping(value = "/school/comments/list")
    @Authority(AuthorityType.Login)
    public ModelAndView school(HttpServletRequest request, PageSchoolId page) {
        ModelAndView mv = new ModelAndView("course/comments/school");
        mv.addObject("retInfo", courseCommentsService.findTdCourseCommentsListSchool(page, request));
        mv.addObject("token", request.getParameter("token"));
        return mv;
    }
}
